package addStrings;

public class Solution {
    public static void main(String[] args) {
        System.out.println(addStrings("12","13"));
    }
    public static String addStrings(String num1, String num2) {
        int t=0;//表示进位
        StringBuilder sb=new StringBuilder();
        int i=num1.length()-1;
        int j=num2.length()-1;
        while(i>=0||j>=0||t!=0){
            int sum=t;
            if(i>=0){
                sum+=(num1.charAt(i)-'0');
                i--;
            }
            if(j>=0){
                sum+=(num2.charAt(j)-'0');
                j--;
            }
            sb.append(sum%10);
            t=sum/10;
        }
        return sb.reverse().toString();
    }
}
